package com.heima.com;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class Demo4 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        for (int i =1 ;i<10;i++){
            list.add(i);
        }
        list.add(10);
        list.add(10);
        list.add(10);
        list.add(10);
        list.add(10);
        List<Integer> list2 = list.stream().filter(s -> s % 2 == 0).collect(Collectors.toList());
        list2.forEach(s-> System.out.print(s+" "));

        Set<Integer> set2 = list.stream().filter(s -> s % 2 == 0).collect(Collectors.toSet());
        set2.forEach(s-> System.out.print(s+" "));

    }
}
